package com.hot100;
@SuppressWarnings("all")
public class h011 {
    public static void main(String[] args) {
        int[] arr = {1,3,2,5,25,24,5};
        System.out.println(maxArea(arr));
    }
    public static int maxArea(int[] height) {
     int left = 0,right = height.length-1;
     int max = 0;
     while (left < right){
         int len = right - left ;
         int ans = Math.min(height[left],height[right]) * len;
         max = Math.max(max,ans);

         if (height[left] > height[right]) right--;
         else left++;
     }
     return max;
    }
}
